package com.monkeyboy.dubbo.service.impl;

import java.util.ArrayList;
import java.util.Map;

import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import com.monkeyboy.dubbo.api.IUserService;
import com.monkeyboy.dubbo.dao.BaseDao;

@Service(timeout = 3000, version = "2.0.0") // service级别超时设置,版本号设置（由于灰度发布服务）
public class UserServiceImpl2 implements IUserService {
	@Autowired
	private BaseDao baseDao;

	@SuppressWarnings("unchecked")
	@Override
	public ArrayList<Map<String, Object>> getAllUser() throws Exception {
		System.err.println("进入【新】服务");
		// Thread.sleep(5000);//超时测试
		return (ArrayList<Map<String, Object>>) baseDao.findForList("UserMapper.getAllUser", null);
	}

	@SuppressWarnings("unchecked")
	@Override
	public Map<String, Object> getUserByUserName(String userName) throws Exception {
		System.err.println(userName);
		return (Map<String, Object>) baseDao.findForObject("UserMapper.getUserByUserName", userName);
	}

}
